'''
Created on Dec 14, 2012

@author: cris
'''
import json
from root import application as app
import os
import logging

'''
    Read the clubs in from file and add 
    return a list containing all of their IDs
'''
def readClubsId():
    
    path = os.path.join(os.path.dirname(app.__file__), 'clubs.txt')
    f = open(path, 'r')
    try:
        clubs = f.readlines();
        club_ids =[]
        for line in clubs :
            d = json.loads(line)
            club_ids.append(d["id"])
    except: 
        logging.error("Could not read club IDs.")
                
    finally:
        f.close()
    return club_ids